package awt;

import java.awt.GridLayout;

import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

public class Demo8 extends JFrame {
	JPanel jp1, jp2;
	JLabel jl1, jl2;
	JComboBox jcb;
	JList jl;
	JScrollPane jsp;

	public Demo8() {
		jp1 = new JPanel();
		jp2 = new JPanel();
		jl1 = new JLabel("籍贯");
		jl2 = new JLabel("旅游地点");
		String cities[] = { "北京", "上海", "天津" };
		jcb = new JComboBox(cities);
		String dd[] = { "天安门", "故宫", "长城" };
		jl = new JList(dd);
		jsp = new JScrollPane(jl);
		jl.setVisibleRowCount(2);

		this.setLayout(new GridLayout(3, 1));

		jp1.add(jl1);
		jp1.add(jcb);

		jp2.add(jl2);
		jp2.add(jsp);

		this.add(jp1);
		this.add(jp2);
		this.setTitle("用户登录");
		this.setSize(300, 300);
		this.setLocation(100, 200);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setVisible(true);

	}

	public static void main(String[] args) {
		Demo8 demo8 = new Demo8();

	}

}
